'use strict';
module.exports = {
	/**
	 * 获取单个每日一练信息
	 * @url client/quest-bank/kh/everyday/getOneEveryDay 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------

		let info = await vk.baseDao.selects({
			dbName: "q_user_everyday_practice",
			getOne: true,
			getMain: true,
			// 主表where条件
			whereJson: { _id: data.id },
			// 副表列表
			foreignDB: [{
				dbName: "q_user_count",
				localKey: "_id",
				foreignKey: "type_id",
				as: "history",
				whereJson: { user_id: uid }
			}]
		});

		res.data = info
		res.data.title = info.set_time + info.cate_name + '每日一练'

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
